package visualcbir.format;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;

/**
 *
 * @author sheila
 */
public class FormatPng implements IFormat{

    @Override
    public void printFormat(File file, IPrintable printable) {
        try {
            // Draw on a standard Graphics2D.
            BufferedImage image = new BufferedImage(500, 500, BufferedImage.TYPE_INT_RGB);
            Graphics2D g = (Graphics2D) image.getGraphics();
            g.setColor(Color.white);
            g.fillRect(0, 0, 500, 500);
            printable.printWithGraphics(g);
            ImageIO.write(image, "png", file);
        } catch (IOException ex) {
            System.err.println("In/Out error in Format Png.");
            Logger.getLogger(FormatPng.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}
